package com.yianke.pet.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.webkit.WebView;

import com.yianke.pet.R;

public class Zinxun_web extends AppCompatActivity {

    private WebView agree_web;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_agree_detial);
        initview();
        initdata();
    }

    private void initdata() {
        Intent intent = getIntent();
        String id = intent.getStringExtra("id");

        String url = "http://119.28.20.68:8080/goodlifeadmin/webview/article/index.html?" + "id="+id+"";
        agree_web = new WebView(this);
        agree_web.getSettings().setJavaScriptEnabled(true);
        agree_web.loadUrl(url);
        setContentView(agree_web);



    }


    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && agree_web.canGoBack()) {
            agree_web.goBack(); //goBack()表示返回WebView的上一页面
            return true;
        }
        return false;
    }


    private void initview() {
        agree_web = (WebView)findViewById(R.id.agree_web);
    }
}
